<script type="text/javascript">

    jQuery(function($) {
        $("#txtFecha").mask("9999-99-99");
    });

</script>
<head>
    <script src="js/items.js" type="text/javascript"></script>
</head>
<body onload="getItems('IdItem')">
    <div style="height: 35px;"></div>

    <table border="0" style="width: 100%;">
        <tbody>
            <tr><td colspan="8"><h1>Administración > Items</h1></td></tr>
            <tr>
                <td>Nombre</td>
                <td><input type="text" id="txtNombre" name="txtNombre" value=""  class="generalInput"/></td>
                <td>Proveedor</td>
                <td>
                    <SELECT name="cboProveedor" id="cboProveedor" class="generalInput">
                        <?php
                        require_once 'MyDB.php';
                        $con = new MyDB();


                        $query = $con->selectFrom("proveedores", $columns = null, $where = null, $like = false, $orderby = null, $direction = "DESC", $limit = null, $offset = null);
                        $result = $query["result"];
                        foreach ($result as $row) {
                            echo "<option value=" . $row["IdProveedor"] . ">" . $row["Nombre"] . "</OPTION>";
                        }
                        ?>
                    </SELECT>
                </td>
                <td>Stock</td>
                <td><input type="number" id="txtStock" name="txtPrecio" value="" step="any" class="generalInput"/></td>
            </tr>
            <tr>
                <td>Precio</td>
                <td><input type="number" step="any" id="txtPrecio" name="txtMensual" value="" class="generalInput"/></td>
                <td>Pto. Reposición</td>
                <td><input type="number" step="any" id="txtPtoReposicion" name="txtExtra" value="" class="generalInput"/></td>
                <td>Cuenta</td>
                <td>
                    <SELECT name="cboCuenta" id="cboCuenta" class="generalInput">
                        <?php
                        require_once 'MyDB.php';
                        $con = new MyDB();
                        
                        
                        $SQL = "select * from cuentas where NroCuenta like '%4.1.1.%'";

                        $query = $con->customSelectFrom($SQL);
//                        $query = $con->selectFrom("cuentas", $columns = null, $where = null, $like = false, $orderby = null, $direction = "DESC", $limit = null, $offset = null);
                        $result = $query["result"];
                        foreach ($result as $row) {
                            echo "<option value=" . $row["NroCuenta"] . ">" . $row["Nombre"] . "</OPTION>";
                        }
                        ?>
                    </SELECT>
                </td>
                <td colspan="3"></td><td><input type="button" value="Guardar" name="save" onclick="saveItem()" class="btnSave"/></td>
            </tr>
            <tr>
                <td colspan="12">
                    <table id="results" class="resultsHeader" style="width: 100%;" cellspacing="0" cellpadding="0" border="0">
                        <thead >
                            <tr >
                                <th style="width: 10px;" onclick="getGastos('IdRoom')" >Id</th>
                                <th onclick="getGastos('Fecha')" >Nombre</th>
                                <th>Proveedor</th>
                                <th>Stock</th>
                                <th>Precio</th>
                                <th>Pto. Repo.</th>
                                <th>Cuenta</th>
                                <th colspan="2">Acciones</th>

                            </tr>
                        </thead>
                        <tbody id="listado">

                        </tbody>    
                    </table>
                </td>
            </tr>
        </tbody>
    </table>
    <input type="hidden" id="hRol" value="<?php echo $_SESSION['ha_rol'] ?>"/>
    <div id="resultadosServer" class="resultadosServer"></div>
</body>